<template>
  <div>
    <el-form>
      <el-form-item label="project_name">
        <el-input v-model="formData.project_name" />
      </el-form-item>
      <el-form-item label="prefix_url">
        <el-input v-model="formData.prefix_url" />
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import axios from 'axios';
import { deepClone } from '@/utils';
import { alertWithPayload } from '@base/utils';
import { lodashFillData } from '@/utils/lodashUtil';

export default {
  data() {
    return {
      formData: {
        id: '',
        prefix_url: '',
        project_name: '',
      },
    };
  },
  methods: {
    async initByDialog(_data) {
       lodashFillData( this.formData,_data?.row)
    },
    async submitByDialog() {
      //validate
      //data operation
      //ajax 提交
      var params=deepClone(this.formData)
      var funcurl='/api/apiproject/add'
      if(params?.id){
        funcurl='/api/apiproject/update'
      }
      var result=await axios.post(funcurl,params).then(res=>res.data)
      alertWithPayload(result)
      return result;
    },
  },
};
</script>
